/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.uw.come.mooba.domain;

import java.net.URL;
import java.text.DateFormat;
import java.util.Calendar;

/**
 * //MOODLE_BACKUP/COURSE/LOGS/LOG
 * @author Piotr Kochański
 */
public class Log {
    private Long id;
    private Calendar time;
    private Long userid;
    private String module;
    private Long cmid;
    private String action;
    private String url;
    private String ip;
    private String info;
    
    public static final String ID_TAG ="ID";
    public static final String TIME_TAG ="TIME";
    public static final String USERID_TAG ="USERID";
    public static final String IP_TAG ="IP";
    public static final String MODULE_TAG ="MODULE";
    public static final String CMID_TAG ="CMID";
    public static final String ACTION_TAG ="ACTION";
    public static final String URL_TAG ="URL";
    public static final String INFO_TAG ="INFO";

    public static final String XPATH = "//MOODLE_BACKUP/COURSE/LOGS/LOG";

    public Log(Long id, Calendar time, Long userid, String module, Long cmid, String action, String url, String ip, String info) {
        this.id = id;
        this.time = time;
        this.userid = userid;
        this.module = module;
        this.cmid = cmid;
        this.action = action;
        this.url = url;
        this.ip = ip;
        this.info = info;
    }

    public Log() {
    }

    



    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public Long getCmid() {
        return cmid;
    }

    public void setCmid(Long cmid) {
        this.cmid = cmid;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getModule() {
        return module;
    }

    public void setModule(String module) {
        this.module = module;
    }

    public Calendar getTime() {
        return time;
    }

    public void setTime(Calendar time) {
        this.time = time;
    }



    public Long getUserid() {
        return userid;
    }

    public void setUserid(Long userid) {
        this.userid = userid;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }


    

    @Override
    public String toString() {
        DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
        return "user with id = " + userid + " performed action " + action + " on " + df.format(time.getTime());
    }



}

/*

 <LOG>
  <ID>13</ID>
  <TIME>1185370142</TIME>
  <USERID>3</USERID>
  <IP>127.0.0.1</IP>
  <MODULE>course</MODULE>
  <CMID>0</CMID>
  <ACTION>enrol</ACTION>
  <URL>view.php?id=2</URL>
  <INFO>3</INFO>
 </LOG>




 *
 */
